package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.FuneralDeadProvider;
import com.jinmdz.fmis.mapper.entity.FuneralDeadEntity;

import java.util.ArrayList;

/**
 * 逝者表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface FuneralDeadMapper {

    /**
     * 增加FuneralDead
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = FuneralDeadProvider.class, method = "insertFuneralDead")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertFuneralDead(@Param("entity") FuneralDeadEntity entity);

    /**
     * 删除FuneralDead
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update funeral_dead set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForFuneralDead(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改FuneralDead
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = FuneralDeadProvider.class, method = "updateFuneralDead")
    void updateFuneralDead(@Param("entity") FuneralDeadEntity entity);

    /**
     * 查询FuneralDead实体
     * 
     * @param id 主键
     * @return FuneralDeadEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,business_code,dead_name,dead_gender_code,dead_nation_code,dead_age_type_code,dead_age,birth_date,certificate_type_code,certificate_no,dead_name_unison,dead_name_abbr,death_date,death_cause,ash_handle_type_code,cremation_type_code,remains_state_code,country_code,province_id,city_id,county_id,town_id,village_id,province_city_county_full_name,household_registration_place,as_local,before_death_address,benefit_district_code,exemption_type_code,death_certificate_no,death_certificate_unit,funeral_certificate_unit,transport_place,as_arrived,arrived_time,negotiator_user_id,remark,whereabout_type_code,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from funeral_dead where id = #{id} and deleted = 0 limit 1 ")
    FuneralDeadEntity getFuneralDeadById(@Param("id") Integer id);

    /**
     * 查询FuneralDead列表
     * 
     * @param entity 数据实体
     * @return FuneralDeadEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = FuneralDeadProvider.class, method = "listFuneralDead")
    ArrayList<FuneralDeadEntity> listFuneralDead(@Param("entity") FuneralDeadEntity entity);
}